

#ifndef _UART_COMM_FRAME_H_
#define _UART_COMM_FRAME_H_


#include "stdint.h"
#include "ringbuff.h"


// Universal uart mesg frame struct ---------

typedef struct
{
	uint8_t  head_H;
	uint8_t  head_L;
	
	uint8_t  frame_ID_L;
	uint8_t  frame_ID_H;

	uint8_t  length_L;
	uint8_t  length_H;
	
	uint8_t  cmd_ID_L;
	uint8_t  cmd_ID_H;
	
	uint8_t* databuf;
	
	uint8_t  CRC_L;
	uint8_t  CRC_H;

}STR_COMM_FRAME;



// extern function -----------------------

extern void comm_frame_upload(STR_COMM_FRAME *frame, STR_RINGBUF* bufhdl);
extern uint8_t comm_frame_store(STR_COMM_FRAME *frame, uint8_t *databuf);

extern int32_t signed24_to_signed32(int32_t input);
extern int16_t i16_LSB_to_MSB(int16_t data);
extern int32_t i32_LSB_to_MSB(int32_t data);
extern int64_t i64_LSB_to_MSB(int64_t data);

#endif




